<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
require_once("../db_connect.php");

//会員登録

	$volunteer_information_id = 11;

	$volunteer_Name  = htmlspecialchars($_POST['volunteer_Name'],ENT_QUOTES,"UTF-8");
	$sub_category_id  = htmlspecialchars($_POST['sub_category_id'],ENT_QUOTES,"UTF-8");
	$content   = htmlspecialchars($_POST['content'],ENT_QUOTES,"UTF-8");
	$age   = htmlspecialchars($_POST['age'],ENT_QUOTES,"UTF-8");
	$Target_Gender   = htmlspecialchars($_POST['Target_Gender'],ENT_QUOTES,"UTF-8");

	$work_time    = htmlspecialchars($_POST['work_time'],ENT_QUOTES,"UTF-8");
	$Location     = htmlspecialchars($_POST['Location'],ENT_QUOTES,"UTF-8");
	$access     = htmlspecialchars($_POST['access'],ENT_QUOTES,"UTF-8");
	$Conditions   = htmlspecialchars($_POST['Conditions'],ENT_QUOTES,"UTF-8");

	$Activity_Date   = date("Y-m-d",mktime(0,0,0,$_POST['Activity_Date_month'],$_POST['Activity_Date_day'],$_POST['Activity_Date_year']));
	$End_time     = date("Y-m-d",mktime(0,0,0,$_POST['End_time_month'],$_POST['End_time_day'],$_POST['End_time_year']));

	$application_number       = htmlspecialchars($_POST['application_number'],ENT_QUOTES,"UTF-8");
	$treatment  = htmlspecialchars($_POST['treatment_id'],ENT_QUOTES,"UTF-8");
	$other  = htmlspecialchars($_POST['other'],ENT_QUOTES,"UTF-8");

	$sql = "UPDATE volunteer_information
			SET volunteer_Name = ?,content = ?,sub_category_id = ?,age = ?,Target_Gender = ?,work_time = ?,Location = ?,access = ?,Conditions = ?,Activity_Date = ?,
				End_time = ?,application_number = ?,treatment_id = ?,other = ?
			WHERE volunteer_information_id = ?";

	$stmt = $db->prepare($sql);

    $data = array($volunteer_Name,
                  $content,
                  $sub_category_id,
                  $age,
                  $Target_Gender,
                  $work_time,
                  $Location,
                  $access,
                  $Conditions,
                  $Activity_Date,
                  $End_time,
                  $application_number,
                  $treatment,
                  $other,
                  $volunteer_information_id);

	$db->execute($stmt, $data);     //UPDATE文を実行

	if (PEAR::isError($db)) {       //SQLの実行に失敗すればここでエラー文を出力
    	die($res->getMessage());
	}

	header("Location: ../user_function/user_display_volunteer.php");
?>

